package com.itheima.d6_object_stream;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.ObjectInputStream;
import java.util.ArrayList;

/*
  目标：掌握对象字节输入流的使用：反序列化对象。
 */
public class Test2ObjectInputStream {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("object.txt");
        ObjectInputStream ois = new ObjectInputStream(fis);

//        Student s = (Student) ois.readObject();
//        System.out.println(s);
        ArrayList<Student> list = (ArrayList<Student>) ois.readObject();
        for (Student s : list) {
            System.out.println(s);
        }
        ois.close();


    }

}
